/*
 * Copyright 2010-2025 JetBrains s.r.o. and Kotlin Programming Language contributors.
 * Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
 */

package org.jetbrains.kotlin.analysis.api.components

import org.jetbrains.kotlin.analysis.api.KaContextParameterApi
import org.jetbrains.kotlin.analysis.api.KaExperimentalApi
import org.jetbrains.kotlin.analysis.api.KaImplementationDetail
import org.jetbrains.kotlin.analysis.api.KaSession
import org.jetbrains.kotlin.analysis.api.lifetime.KaLifetimeOwner
import org.jetbrains.kotlin.analysis.api.projectStructure.KaModule
import org.jetbrains.kotlin.analysis.api.scopes.KaScope

/**
 * Provides declarations generated by compiler plugins.
 */
@KaExperimentalApi
@KaSessionComponentImplementationDetail
@SubclassOptInRequired(KaSessionComponentImplementationDetail::class)
public interface KaCompilerPluginGeneratedDeclarationsProvider : KaSessionComponent {
    /**
     * [Declarations][KaCompilerPluginGeneratedDeclarations] generated by compiler plugins for [this] module, not including the generated
     * declarations for *dependencies* of this module.
     */
    @KaExperimentalApi
    public val KaModule.compilerPluginGeneratedDeclarations: KaCompilerPluginGeneratedDeclarations
}

/**
 * Represents declarations generated by compiler plugins.
 *
 * @see KaCompilerPluginGeneratedDeclarationsProvider
 */
@KaExperimentalApi
@SubclassOptInRequired(KaImplementationDetail::class)
public interface KaCompilerPluginGeneratedDeclarations : KaLifetimeOwner {
    /**
     * A [KaScope] containing the top-level declarations generated by compiler plugins.
     */
    public val topLevelDeclarationsScope: KaScope
}

/**
 * [Declarations][KaCompilerPluginGeneratedDeclarations] generated by compiler plugins for [this] module, not including the generated
 * declarations for *dependencies* of this module.
 */
// Auto-generated bridge. DO NOT EDIT MANUALLY!
@KaExperimentalApi
@KaContextParameterApi
context(s: KaSession)
public val KaModule.compilerPluginGeneratedDeclarations: KaCompilerPluginGeneratedDeclarations
    get() = with(s) { compilerPluginGeneratedDeclarations }
